<!--
* description: 相关基准车系弹出框
* author: dxuem
* createdDate: 2019-11-20
-->
<template>
  <section class="carTypeConfig">
    <el-dialog v-dialogDrag
      title="相关基准车系"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="sendCode"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <dialogHeader
        slot="title"
        :title="'相关基准车系'"
        :styleType="$store.state.app.dialogType"
      ></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";

export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      // 网格查询API配置对象
      apiConfig: crmApis.mdmVeCarConfigQueryListForPage,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.queryTable(1),
          text: "查询",
          position: "top"
        }, //查询
        {
          compKey: "btnKey3",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode("baseSeriesName", "baseCarSeriesCn"),
          text: "确认",
          position: "bottom"
        }, //确认
        {
          compKey: "btnKey2",
          type: "",
          size: "small",
          clickEvent: () => this.reset(),
          text: "重置",
          position: "top"
        } //重置
      ],
      // 动态组件-查询条件
      tableComponents: [
        // 显示组件
        // {
        //   compKey: "compKey1",
        //   labelName: "车辆品牌",
        //   codeField: "carBrandCode",
        //   component: () => import("@/components/org/carBrand/carBrand"),
        //   type: "dropdownList",
        //   isMust: true
        // },
        {
          compKey: "compKey1",
          labelName: "车辆品牌",
          codeField: "carBrandCode",
          textField: "carBrandCn",
          lookuptype: crmApis.mdmCarBrandQueryByPage,
          component: () => import("@/components/crm/lookupValue/singleDropList"),
          type: "dropdownList",
          isMust: true,
          isMul: false
        },
        // {
        //   compKey: "compKey2",
        //   labelName: "车系",
        //   codeField: "carSeriesId",
        //   // parentFileds: "carBrandCode",
        //   component: () => import("@/components/org/CarCode"),
        //   type: "dropdownList",
        //   // disabled:this.formField.carSeriesId===""?false:true,
        //   isMust: true
        // },
        {
          compKey: "carBrandCode",
          labelName: "车系",
          codeField: "carSeriesId",
          textField: "carSeriesCn",
          isRequire: false,
          isMust: true,
          isMul: false,
          lookuptype: crmApis.mdmVeCarSeriesQueryListForPage,
          changeCodeArray: [
            { changCode:"carBrandCode" }
          ],
          component: () => import("@/components/crm/lookupValue/secondDropList")
        },
        {
          compKey: "compKey3",
          labelName: "车型配置",
          codeField: "carConfigCn",
          component: () => import("@/components/crm/textbox/crmTextInput"),
          type: "dropdownList",
          isMust: true
        } //车型配置
      ],
      // 动态生成网格列
      tableCols: [
        {
          prop: "carBrandCn",
          label: "车辆品牌",
          width: 115,
          align: "center"
        }, //品牌
        {
          prop: "baseSeriesCode",
          label: "基准车系编码",
          width: 120,
          align: "center"
        }, //'车系'
        {
          prop: "baseCarSeriesCn",
          label: "基准车系",
          width: 170,
          align: "center"
        }, //车型
        {
          prop: "carSeriesCode",
          label: "车系编码",
          width: 80,
          align: "center"
        }, //车型名称
        {
          prop: "carSeriesCn",
          label: "车系",
          width: 0,
          align: "center",
          hidden: true
        },
        {
          prop: "smallCarTypeCn",
          label: "车型",
          width: 0,
          align: "center",
          hidden: true
        },
        {
          prop: "carConfigCn",
          label: "车型配置",
          width: 0,
          align: "center"
        }, //车型配置
        {
          prop: "carBrandCode",
          label: "车辆品牌编码",
          width: 0,
          align: "center",
          hidden:true,
        } /*车型配置中文名称*/,
        {
          prop: "smallCarTypeCode",
          label: "车型编码",
          width: 80,
          align: "center",
          hidden:true,
        },
        {
          prop: "carSeriesId",
          label: "车系编码",
          width: 80,
          align: "center",
          hidden:true,
        },
        {
          prop: "smallCarTypeId",
          label: "车型Id",
          width: 80,
          align: "center",
          hidden:true,
        },
        {
          prop: "baseSeriesId",
          label: "基准车系Id",
          width: 80,
          align: "center",
          hidden:true,
        }
      ],
      //表单查询数据（查询条件）
      formField: {
        carBrandCode: "",
        carSeriesId: "",
        carConfigCn: "",
      },
      handleTableRowData: {
        value: "baseSeriesName",
        text: "baseCarSeriesCn"
      }
    };
  }
};
</script>
